package org.ezplatform.office.meeting.setting.serve.web.rest;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.ezplatform.cloud.common.controller.BaseController;
import org.ezplatform.core.web.view.OperationResult;
import org.ezplatform.office.meeting.setting.boardroom.entity.BoardroomSet;
import org.ezplatform.office.meeting.setting.boardroom.service.BoardroomSetService;
import org.ezplatform.office.meeting.setting.serve.service.ServeSetService;
import org.ezplatform.util.ValidateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

/**
 * @ClassName: ServeSetController
 * @Description: 会议服务设置控制类
 */
@RestController("serveSetfac")
@RequestMapping("api/meeting/serveSet")
public class ServeSetApiController extends BaseController{
    
	@Autowired
	private ServeSetService service;
	
	@Autowired
	private BoardroomSetService boardroomSetService;

    /**
     * 查询会议室的服务树数据
     * 
     * @return
     */
	@ApiImplicitParams({
    	@ApiImplicitParam(name = "corpId", value = "查询条件", required = true, paramType = "query", dataType = "String"),
        @ApiImplicitParam(name = "boardroomId", value = "查询条件", required = true, paramType = "query", dataType = "String")
    })
    @RequestMapping(value = "/getBoardRoomServeTreeData", method = RequestMethod.GET)
    @ResponseBody
    public OperationResult getBoardRoomServeTreeData(HttpServletRequest request) {
		Map<String, Object> map = new HashMap<>();
		String corpId = request.getParameter("corpId");
        String boardroomId = ValidateUtils.filter(request.getParameter("boardroomId"));
        List jeson = this.service.getBoardRoomServeTreeDataList(corpId,boardroomId);
        map.put("serve", jeson);
        BoardroomSet boardroom = this.boardroomSetService.findOne(boardroomId);
        map.put("boardRoom", boardroom);
        return OperationResult.buildSuccessResult(map);
    }
}
